package com.mall.user.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mall.model.vo.UserStatsVO;
import com.mall.user.model.dto.user.UserQueryRequest;
import com.mall.user.model.entity.User;
import com.mall.user.model.vo.LoginUserVO;
import com.mall.user.model.vo.UserVO;
import jakarta.servlet.http.HttpServletRequest;

import java.math.BigDecimal;
import java.util.List;

/**
* @author 张云博
* @description 针对表【user(用户表)】的数据库操作Service
* @createDate 2025-08-29 10:04:36
*/
public interface UserService extends IService<User> {

    long userRegister(String userName, String userPassword, String checkPassword);

    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    User getLoginUser(HttpServletRequest request);

    boolean userLogout(HttpServletRequest request);

    boolean updatePasswordById(Long userId, String encodedPassword);

    LoginUserVO getLoginUserVO(User user);

    UserVO getUserVO(User user);

    List<UserVO> getUserVO(List<User> userList);

    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    UserStatsVO getUserStats();

    /**
     * 扣减用户消费金额（用于退款）
     */
    boolean deductAccountBalance(Long UserId, BigDecimal totalPay);

    /**
     * 增加用户消费金额（用于支付）
     */
    boolean addAccountBalance(Long UserId, BigDecimal totalPay);
}
